#pragma once

#include "KnowledgeBaseMemoryFake.h"
#include "KnowledgeBaseWriterFile.h"
#include "KnowledgeBaseWriterText.h"
#include "KnowledgeBaseWriterTextLocalizationFake.h"
#include "TextStreamFake.h"

namespace TestKnowledgeBaseWriter
{

void RunAllTests ();

class TestBase
{
public:
	std::string SuiteIdentity ();
	virtual std::string TestIdentity () = 0;
protected:
	TestBase ();
	virtual ~TestBase ();
	void AddElement 
		( int seniorKey
		, int seniorType
		, std::string lexemText
		, int upperBranch
		, int lowerBranch
		, int nextLevel
		, int synonym
		, int adjacentAscending
		, int adjacentDescending
		, int beforeAdjacentAscending
		, int beforeAdjacentDescending
		, int greaterAscending
		, int greaterDescending
		, int lesserAscending
		, int lesserDescending
		);
	void Check ();
private:
	static std::string Diff ( std::string original, std::string comparedTo );
	static std::string Highlighted ( char ch );
protected:
	KnowledgeBaseMemoryFakePtr memory;
	TextStreamFakePtr textStream;
	std::string expectedOutput;
};

class TestTextWriter
: public TestBase
{
public:
	static void Run ();
	virtual std::string TestIdentity ();
private:
	void RunSingle ();
private:
	TestTextWriter ();
	virtual ~TestTextWriter ();
private:
	KnowledgeBaseWriterTextLocalizationFakePtr writerLocalization;
};

class TestFileWriter
: public TestBase
{
public:
	static void Run ();
	virtual std::string TestIdentity ();
private:
	void RunSingle ();
private:
	TestFileWriter ();
};

}; // namespace TestKnowledgeBaseWriter
